<template>
  <div class="container">
    <div class="form-list">
      <div v-if="show">
        <p class="file-text">
          我已阅知上述内容，并将遵守上述安全提示及相关法律法规要求。
        </p>
      </div>
      <!-- <pdf :src="pdfPath" class="pdf"></pdf> -->
      <!-- <iframe src="http://192.168.188.105:8900/h5/Uploads/147492/222.docx" width='100%' height='100%'  ></iframe> -->
      <!-- <DocxToHtml ></DocxToHtml> -->
      <iframe style="  position: fixed;" :src="iframeSrc" width="100%" height="80%"  >该浏览器无法支持PDF,请点击查看;
      <!-- <a :href="iframeSrc">下载 PDF</a> -->
      </iframe>

    </div>
    <div class="fixedBottom">
      <van-checkbox v-model="opinion" shape="square" @click="showtext"
        >我已阅知上述内容，并将遵守上述安全提示及相关法律法规要求。</van-checkbox
      >
      <van-button
        type="info"
        :disabled="isdisabled"
        @click="benext"
        size="large"
        >完成阅读</van-button
      >
    </div>
  </div>
</template>


<script>
import { getAxios2 } from "@/utils/request2";
// import DocxToHtml from 'docx-to-html'
import pdf from "vue-pdf";
export default {
  data() {
    return {
      show: false,
      opinion: "",
      isdisabled: true,
      pdfPath: "",
      iframeSrc:'',

    };
  },
  components: {
    pdf,
    // DocxToHtml
  },
  mounted() {
 
    this.industryType = this.$route.query.industryType;
    this.getPdfPath();
  },
  methods: {
    showtext: function () {
      this.show = !this.show;

      this.isdisabled = !this.show;
    },
    benext() {
      this.$router.push({ path: "/fgbm/signature"});
    },
    async getPdfPath() {
      let axios2=await getAxios2()
      const res = await axios2.get(
        `https://fgbm.zatsafety.com/app/study/detail?industryType=${this.industryType}`
      );
      console.log(res,'res');
      // this.pdfPath = res.data.protocol.split(":=")[1];
      //拿到 要展示的 路径 
      // this.pdfPath = res.data.protocol  
      this.iframeSrc = 'https://view.officeapps.live.com/op/embed.aspx?src='+res.data.protocol  
      // this.pdfPath='http://dgyj.safetyhua.com/Uploads/00225/Report/d106a435d32441819669b1ff55123b2b-temp.pdf'
      // this.pdfPath='https://fgbm.oss-cn-shenzhen.aliyuncs.com/content/file/20230905140802220test.doc'
      // this.pdfPath='http://192.168.188.105:8900/h5/Uploads/147492/222.docx'
      // this.iframeSrc='https://view.officeapps.live.com/op/embed.aspx?src=https://fgbm.oss-cn-shenzhen.aliyuncs.com/content/file/20230905140802220test.doc'
      console.log(this.pdfPath);
    },
  },
};
</script>

<style lang="less" scoped>
.container {
  .form-list {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    overflow: hidden;
    // display: flex;
    // justify-content: center;
    .pdf {
      border-radius: 10px;
    }
    .iframe{
    
    }
  }
}
.file-text {
  position: fixed;
  top: 70px;
  left: 5%;
  right: 5%;
  width: 90vw;
  color: #f980a0;
  z-index: 101;
}

.fixedBottom {
  position: fixed;
  bottom: 5px;
  width: 96%;
  margin-left: 10px;
}
</style>